import { defineConfig } from 'vite'
import AutoImport from 'unplugin-auto-import/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import Components from 'unplugin-vue-components/vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path';
 
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    AutoImport({
       imports: ['vue', 'vue-router'],
       resolvers: [ElementPlusResolver()]
    }),
    Components({
       resolvers: [ElementPlusResolver()],
    })
  ],
  server: {
    open: true,
    host: '0.0.0.0'
  },
  resolve: {
    alias: [
      {
        find: '@',                                   // 别名
        replacement: resolve(__dirname, 'src'),      // 别名对应地址
      },
      {
        find: 'components',
        replacement: resolve(__dirname, 'src/components'),
      }
    ]
  },
  css: {
    preprocessorOptions: {
          scss: {// 导入scss的全局默认配置
             additionalData: `@import "@/assets/scss/common.scss";`
          }
    }
  },
  
})